# !/usr/bin/env python
# -*- coding:utf-8 -*-

import configparser
from urlTestDemo.redisUtils import initRedisUtils

cf = configparser.ConfigParser()
cf.read("config/application.ini")
# cf.read("config/application.config")
redisUtil = initRedisUtils()

# 解析邮轮信息
def parseShipInfo():
    secs = cf.sections()
    opts = cf.options("ship")
    kvs = cf.items("ship")
    ship_db_host = cf.get("ship","ship_db_host")
    redisUtil.set("ship_db_host",ship_db_host)

    ship_db_port = cf.get("ship","ship_db_port")
    redisUtil.set("ship_db_port", ship_db_port)

    ship_db_user = cf.get("ship","ship_db_user")
    redisUtil.set("ship_db_user", ship_db_user)

    ship_db_password = cf.get("ship","ship_db_password")
    redisUtil.set("ship_db_password", ship_db_password)

    ship_db_name = cf.get("ship","ship_db_name")
    redisUtil.set("ship_db_name", ship_db_name)

    ship_pre_url = cf.get("ship","ship_pre_url")
    redisUtil.set("ship_pre_url", ship_pre_url)

    ship_search_sql = cf.get("ship","ship_search_sql")
    redisUtil.set("ship_search_sql", ship_search_sql)

# 解析签证信息
def parseVisaInfo():
    visa_db_host = cf.get("visa","visa_db_host")
    redisUtil.set("visa_db_host",visa_db_host)

    visa_db_port = cf.get("visa","visa_db_port")
    redisUtil.set("visa_db_port", visa_db_port)

    visa_db_user = cf.get("visa","visa_db_user")
    redisUtil.set("visa_db_user", visa_db_user)

    visa_db_password = cf.get("visa","visa_db_password")
    redisUtil.set("visa_db_password", visa_db_password)

    visa_db_name = cf.get("visa","visa_db_name")
    redisUtil.set("visa_db_name", visa_db_name)

    visa_pre_url = cf.get("visa","visa_pre_url")
    redisUtil.set("visa_pre_url", visa_pre_url)

    visa_search_sql = cf.get("visa","visa_search_sql")
    redisUtil.set("visa_search_sql", visa_search_sql)

# 初始化项目配置信息
def initSysConfInfo():
    parseShipInfo()
    parseVisaInfo()
